ÿþ--[[ x: JX-API-07 Tðy: Rú^ûN¡R`lv^ TekFUÁTagxáOo` \O€: åeg: 2025-1-29 eQãSýQpeÿ sync ŸRý€ô‹f: ¥c6eegê N8nû|ß~„vFUÁTagxáOo` ÿv^\vQ Tek0RûN¡R`l `TaskPool`0 “eQ: FUÁTagxáOo` (Array) { "trayNo": "TK0012345", -- XbØv÷S "trayType": "ánXb", -- XbØv{|‹W "sourceSys": "è]f", -- egnû|ß~ "sourNo": "JX78", -- N8nûN¡R÷S "IsLong": "0", -- /f&T•öeô• NO(u "taskType": "eQ“^", -- \ON{|‹W "desArea":"ZG2" -- È~¹p“^:S } ØSôf°‹U_: --]] wms_base = require( "wms_base" ) wms_cntr = require( "wms_container" ) function sync(strLuaDEID) local nRet, idcode local empty_full local outTaskInfo local taskCondition,strRetInfo nRet, idcode = m3.GetSysDataJson(strLuaDEID) if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "àeÕl·ƒÖSpencS datajson!" .. idcode) end -- Àhåg OeQ„vXbØváOo`/f&T:Nzz if (idcode == nil or idcode == '')then lua.Error(strLuaDEID, debug.getinfo(1), "¡l gïSYt„vXbØváOo`") end lua.Debug( strLuaDEID, debug.getinfo(1), "idcode-->", idcode ) local cntr_code = lua.Get_StrAttrValue(idcode.trayNo) --XbØv÷S local source_sys = lua.Get_StrAttrValue(idcode.sourceSys) --egnû|ß~ local sour_no = lua.Get_StrAttrValue(idcode.sourNo) -- N8nûN¡R÷S local tray_type = lua.Get_StrAttrValue(idcode.trayType) --XbØv{|‹W local end_area_code = lua.Get_StrAttrValue(idcode.desArea) --È~¹p“^:S local task_type = lua.Get_StrAttrValue(idcode.taskType) --\ON{|‹W if (cntr_code == '') then lua.Error(strLuaDEID, debug.getinfo(1), "XbØv÷S Ný€:Nzz!") end if (tray_type == '') then lua.Error(strLuaDEID, debug.getinfo(1), "XbØv{|‹W Ný€:Nzz!") end if (source_sys == '') then lua.Error(strLuaDEID, debug.getinfo(1), "egnû|ß~ Ný€:Nzz!") end if (sour_no == '') then lua.Error(strLuaDEID, debug.getinfo(1), " N8nûN¡R÷S Ný€:Nzz!") end if (end_area_code == '') then lua.Error(strLuaDEID, debug.getinfo(1), "È~¹p“^:S Ný€:Nzz!") end -- if (task_type == '') then -- lua.Error(strLuaDEID, debug.getinfo(1), "\ON{|‹W Ný€:Nzz!") -- end -- if (task_type == "eQ“^" and end_area_code ~= "ZG2") then -- lua.Error(strLuaDEID, debug.getinfo(1), "\ON{|‹W:NeQ“^öe,È~¹p“^:SÅ_{˜:NZG2") -- elseif (task_type == "ÙzðS,dЏ" and end_area_code == "ZG2") then -- lua.Error(strLuaDEID, debug.getinfo(1), "\ON{|‹W:NÙzðS,dЏöe,È~¹p“^:S Ný€:NZG2") -- end -- ågâ‹ûN¡R`l-N/f&Tò]X[(Wøv Tpencÿ9hncXbØv÷S0ûN¡R¶r`ŒTûN¡R÷S ÿ local outTaskCondition = "(S_CNTR_CODE = '" .. cntr_code .. "' AND N_B_STATE IN (0,1)) OR (S_SOURNO = '" .. sour_no .. "')" local nRetTask, outTaskInfo = mobox.existThisData(strLuaDEID, "JX_Task", outTaskCondition) if (nRetTask ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "ågâ‹ûN¡R`löeÑSu•ï‹: " .. outTaskInfo) end if (outTaskInfo == "yes") then lua.Error(strLuaDEID, debug.getinfo(1), "ûN¡R`l-Nò]X[(Wøv TûN¡R: XbØv÷S " .. cntr_code .. ", ûN¡R÷S " .. sour_no) end --$R­eÈ~¹p“^:S/f&TX[(W strCondition = "S_CODE='" .. end_area_code .. "'" nRet, strRetInfo = mobox.existThisData(strLuaDEID, "Area", strCondition) if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "ÀhågÈ~¹p“^:S'" .. end_area_code .. "'öeÑSu•ï‹ ÿïSý€/f: " .. strRetInfo) end if (strRetInfo ~= "yes") then lua.Error(strLuaDEID, debug.getinfo(1), "È~¹p“^:S'" .. end_area_code .. "' NX[(W ÿ÷‹Àhåg“eQ") end --$R­e¹[hVŒTegnû|ß~/f&Tù[„v N local cntr_obj nRet, cntr_obj = wms_cntr.GetInfo( strLuaDEID, cntr_code ) lua.Debug( strLuaDEID, debug.getinfo(1), "cntr_obj-->", cntr_obj ) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "·ƒÖS¹[hVù[aŒ1Y%! "..cntr_obj ) end if ( cntr_obj == '' ) then lua.Error( strLuaDEID, "x = '"..cntr_code.."'„vãb™e±{ NX[(W!") end -- $R­e™e±{/f&Tò]Ï~ gÑ~š[ if ( cntr_obj.source ~= 'è]f' ) then lua.Error( strLuaDEID, "x = '"..cntr_code.."'„vãb™e±{ N/fè]f„v") end if (cntr_obj.position ~= nil and cntr_obj.position ~= "") then lua.Error(strLuaDEID, debug.getinfo(1), "™e±{÷S = '"..cntr_code.."' „vãb™e±{ò](W“^…Q ÿMOn: " .. tostring(cntr_obj.position)) end -- Rú^ûN¡R`lù[aŒ local jx_task = m3.AllocObject(strLuaDEID, "JX_Task") jx_task.cntr_code = cntr_code --XbØv÷S jx_task.tray_type = tray_type --XbØv{|‹W jx_task.source_sys = source_sys --egnû|ß~ jx_task.sour_no = sour_no -- N8nûN¡R÷S jx_task.is_long = idcode.IsLong jx_task.end_area_code = idcode.desArea --È~¹p“^:S jx_task.task_type = "eQ“^" -- \ON{|‹W jx_task.create_method = "JX-WMS" jx_task.start_wh_code = wms_base.Get_sConst(strLuaDEID, "؞¤‹ÓN“^hƋ") --ÓN“^ nRet, jx_task = m3.CreateDataObj(strLuaDEID, jx_task) if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "Rú^ûN¡R`l°‹U_1Y%!" .. jx_task) end lua.Debug( strLuaDEID, debug.getinfo(1), "jx_task-->", jx_task ) --(uegôf°e¹[hVhˆ„vzzán¶r` if (tray_type == "ánXb") then empty_full = 2 else empty_full = 0 end local strUpdateSql = "N_EMPTY_FULL = " .. empty_full local strCondition = "S_CODE = '"..cntr_code.."'" nRet, strRetInfo = mobox.updateDataAttrByCondition( strLuaDEID, "Container", strCondition, strUpdateSql ) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "ôf°e0¹[hV0¶r`o`1Y%!"..strRetInfo ) end -- ԏÞVbŸRˆmo` return json.encode({status = "success", message = "ûN¡R`lRú^bŸR!"}) end